package org.hj.modules.act.rutask;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import org.hj.modules.AcStartController;
import org.hj.modules.act.actmodel.service.ActModelService;
import org.hj.modules.chapter.entity.ActeChapter;
import org.hj.modules.chapter.service.IActeChapterService;
import org.hj.modules.entity.*;
import org.hj.modules.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *
 * 根据单据类型和id，修改对应表的提交状态
 * @author gbw
 * 2020/8/5
 */
public class RuTaskFact {

    //公章管理
    @Autowired
    private IActeChapterService acteChapterService;
    //业务付款
    @Autowired
    private IActeBusiPaymentService acteBusiPaymentService;
    //请假申请
    @Autowired
    private IActeLeaveApplicationService acteLeaveApplicationService;
    //出差申请
    @Autowired
    private IActeLeaveService acteLeaveService;
    //预支申请
    @Autowired
    private IActeLoanService acteLoanService;
    //加班申请单
    @Autowired
    private IActeOvertimeService acteOvertimeService;
    //离职单
    @Autowired
    private IActeQuitService acteQuitService;
    //补卡申请
    @Autowired
    private IActeTimecardService acteTimecardService;



    public void update(String type,String id,String status){

        switch (type) {
            case "盖章申请":
                ActeChapter acteChapter = acteChapterService.getById(id);
                acteChapter.setAppstatus(status);
                acteChapterService.updateById(acteChapter);

                acteChapter=null;
                break;
            case "请假单":
                ActeLeaveApplication leaveApplication = acteLeaveApplicationService.getById(id);
                leaveApplication.setAppstatus(status);
                acteLeaveApplicationService.updateById(leaveApplication);
                leaveApplication=null;
                break;
            case "出差单":
                ActeLeave acteLeave = acteLeaveService.getById(id);
                acteLeave.setAppstatus(status);
                acteLeaveService.updateById(acteLeave);
                acteLeave=null;
                break;
            case "借款单":
                ActeLoan acteLoan = acteLoanService.getById(id);
                acteLoan.setAppstatus(status);
                acteLoanService.updateById(acteLoan);
                acteLoan=null;
                break;
            case "加班单":
                ActeOvertime acteOvertime = acteOvertimeService.getById(id);
                acteOvertime.setAppstatus(status);
                acteOvertimeService.updateById(acteOvertime);
                acteOvertime=null;
                break;
            case "离职单":
                ActeQuit acteQuit = acteQuitService.getById(id);
                acteQuit.setAppstatus(status);
                acteQuitService.updateById(acteQuit);
                acteQuit=null;
                break;
            case "补打卡单":
                ActeTimecard acteTimecard = acteTimecardService.getById(id);
                acteTimecard.setAppstatus(status);
                acteTimecardService.updateById(acteTimecard);
                acteTimecard=null;
                break;
            case "业务付款":
                ActeBusiPayment acteBusiPayment = acteBusiPaymentService.getById(id);
                acteBusiPayment.setAppstatus(status);
                acteBusiPaymentService.updateById(acteBusiPayment);
                acteBusiPayment=null;
                break;

        }

    }
}
